<template>
	<view>
		<view class="">
			{{info.title}}
		</view>
		<view class="">
			{{info.info}}
		</view>
		<view class="">
			{{info.source}}
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		api,
		tools
	} from '../../api/api.js'

	import {
		onLoad,
		onReady
	} from '@dcloudio/uni-app'


	onLoad((event) => {
		console.log('加载信息: ', event)
		nid.value = event.nid
		query()
	})

	const nid = ref(-1)

	const info = ref({})

	const query = () => {
		api.get(`/crud/news/${nid.value}`, {}, (data) => {
			if (data.success) {
				info.value = data.data
				return
			}
			uni.showToast({
				title: data.message,
				complete: () => {
					uni.navigateTo({
						url: '/pages/news/news'
					})
				}
			})
		})
	}
</script>

<style>

</style>